home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
WarriorsProgress.sit
/
Warrior’s Progress
/
source code
/
Source
/
Libraries
/
Integers
/
Integers.h
< prev
next >
Wrap
Text File
|
1997-06-28
|
2KB
|
66 lines
// Integers.h
#ifndef Integers_h
#define Integers_h
typedef char int8;
enum { minint8 = -0x80, maxint8 = 0x7f };
typedef unsigned char uint8;
enum { maxuint8 = 0xff };
typedef short int16;
enum { minint16 = -0x8000, maxint16 = 0x7fff };
typedef unsigned short uint16;
enum { maxuint16 = 0xffff };
typedef long int32;
enum { minint32 = -0x7fffffff-1, maxint32 = 0x7fffffff };
typedef unsigned long uint32;
enum { maxuint32 = 0xffffffff };
typedef long long int64;
typedef unsigned long long uint64;
inline uint8 Byte0( uint16 x ) { return ( x ) & 0xff; }
inline uint8 Byte1( uint16 x ) { return ( x >> 8 ) & 0xff; }
inline uint8 Byte2( uint32 x ) { return ( x >> 16 ) & 0xff; }
inline uint8 Byte3( uint32 x ) { return ( x >> 24 ) & 0xff; }
inline uint8 Byte4( uint64 x ) { return ( x >> 32 ) & 0xff; }
inline uint8 Byte5( uint64 x ) { return ( x >> 40 ) & 0xff; }
inline uint8 Byte6( uint64 x ) { return ( x >> 48 ) & 0xff; }
inline uint8 Byte7( uint64 x ) { return ( x >> 56 ) & 0xff; }
inline uint16 Word0( uint32 x ) { return ( x ) & 0xffff; }
inline uint16 Word1( uint32 x ) { return ( x >> 16 ) & 0xffff; }
inline uint16 Word2( uint64 x ) { return ( x >> 32 ) & 0xffff; }
inline uint16 Word3( uint64 x ) { return ( x >> 48 ) & 0xffff; }
bool CanAdd( uint8 a, uint8 b );
bool CanAdd( uint16 a, uint16 b );
bool CanAdd( uint32 a, uint32 b );
bool CanAdd( int8 a, int8 b );
bool CanAdd( int16 a, int16 b );
bool CanAdd( int32 a, int32 b );
bool CanSubtract( uint8 a, uint8 b );
bool CanSubtract( uint16 a, uint16 b );
bool CanSubtract( uint32 a, uint32 b );
bool CanSubtract( int8 a, int8 b );
bool CanSubtract( int16 a, int16 b );
bool CanSubtract( int32 a, int32 b );
bool CanMultiply( uint8 a, uint8 b );
bool CanMultiply( uint16 a, uint16 b );
bool CanMultiply( uint32 a, uint32 b );
bool CanMultiply( int8 a, int8 b );
bool CanMultiply( int16 a, int16 b );
bool CanMultiply( int32 a, int32 b );
#endif